/**
 *
 * @param {Array} nums
 * @param {Array} appearArray
 * @returns {number}
 */
function removeDuplicates(nums, appearArray = [], index = 0) {
    
    if (index === nums.length - 1) {
        return nums.length;
    }

    for (index; index < nums.length; index++) {
        const element = nums[index];
        if (!appearArray.includes(element)) {
            appearArray.push(element);
        } else {
            nums.splice(index, 1);
            return removeDuplicates(nums, appearArray, index);
        }
    }
}

console.log("让我康康!", removeDuplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4]));
